package cn.darkhorse.core.param;

import cn.darkhorse.entity.BpmnWorkflowParam;

import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;

/**
 * 针对WorkflowParam的param_class 为 WorkflowParamConsts#CLASS_TASK_USER 的实现
 * @author yuanjun
 * @since 2020/6/3 15:42
 */
public class ParserStrategy4TaskUser implements IParamParserStrategy {
    @Override
    public Map<String, Object> parse(BpmnWorkflowParam param) {
        Map<String, Object> resultMap = new HashMap<>(2);
        String key = String.format("%s_assigneeList", param.getElementKey());
        resultMap.put(key, Arrays.asList(param.getParamValue().split(",")));
        return resultMap;
    }

    @Override
    public <T> Map<String, Object> parse(BpmnWorkflowParam param, Class<T> tClazz, T form,String userName){
        return this.parse(param);
    }
}
